package com.google.irwin.service;

public class Service
{
	protected ServiceResult serviceResult;
	
	protected void doSetup()
	{
		// do nothing
	}
	
	protected void doFinish()
	{
		// do nothing
	}
	
	protected void doExecute()
	{
		// do nothing
	}
	
	protected void doFailure(Exception e)
	{
		// do nothing
	}
	
	public void execute()
	{
		try
		{
			doSetup();
			doExecute();
			doFinish();
		}
		catch (Exception e)
		{
			doFailure(e);
		}
	}

	public ServiceResult getServiceResult()
	{
		return serviceResult;
	}

}
